<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    var name = "这是全局name";
    var obj1 = {
      name:"李四"
    }
    var obj = {};
    obj.name = "张三";
    obj.show = function () {
      //console.log(this);//obj对象
      setTimeout(function (age) {//setTimeout 是window下的方法
        // console.log(this); window
        console.log(this.name +age+ "是一位优秀的学员");
      }.bind(this,12),100); //this指向obj对象
    };
    obj.show();//需要调用才能执行
  </script>
</html>
